From 3ccbd5a7cb6d79b83202c2b7b63687a576ebad94 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 20 Jan 2006 19:18:37 +0000 Subject: [PATCH] add gcc 3.4.4 patch from trunk, libgcc is linked explictly. tested nmap and kismet, both works still fine, PLEASE do not forget to rebuild your toolchain, otherwise you will create _broken_ images. VERY IMPORTANT make distclean, before compile on your existing buildroot SVN-Revision: 3031 --- openwrt/package/Config.in | 1 + openwrt/package/base-files/Config.in | 6 ++++++ openwrt/package/base-files/Makefile | 17 +++++++++++++---- openwrt/package/kismet/Makefile | 2 +- .../package/kismet/ipkg/kismet-server.control | 2 +- openwrt/package/nmap/Makefile | 2 +- openwrt/package/nmap/ipkg/nmap.control | 2 +- .../linux/imagebuilder/lists/default.brcm-2.4 | 1 - .../linux/imagebuilder/lists/micro.brcm-2.4 | 1 - .../linux/imagebuilder/lists/pptp.brcm-2.4 | 1 - .../gcc/3.4.4/static-libgcc.patch.conditional | 11 +++++++++++ openwrt/toolchain/gcc/Makefile | 10 ++++++++++ 12 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 openwrt/package/base-files/Config.in create mode 100644 openwrt/toolchain/gcc/3.4.4/static-libgcc.patch.conditional diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index 73b031c608..681f4390bd 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -94,6 +94,7 @@ source "package/glib/Config.in" source "package/libdb/Config.in" source "package/libelf/Config.in" source "package/libevent/Config.in" +source "package/base-files/Config.in" # libgcc source "package/libgd/Config.in" source "package/libgdbm/Config.in" source "package/gmp/Config.in" # libbgmp diff --git a/openwrt/package/base-files/Config.in b/openwrt/package/base-files/Config.in new file mode 100644 index 0000000000..6ddbc0d4f6 --- /dev/null +++ b/openwrt/package/base-files/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_LIBGCC + tristate "libgcc - GCC support library" + default m if CONFIG_DEVEL + help + GCC support library + diff --git a/openwrt/package/base-files/Makefile b/openwrt/package/base-files/Makefile index 09df0abeea..f291c4ec9a 100644 --- a/openwrt/package/base-files/Makefile +++ b/openwrt/package/base-files/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=base-files -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_BUILD_DIR:=$(BUILD_DIR)/base-files include $(TOPDIR)/package/rules.mk @@ -19,7 +19,16 @@ GCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version} IDIR_GCC:=$(PKG_BUILD_DIR)/libgcc IPKG_GCC:=$(PACKAGE_DIR)/libgcc_$(GCC_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -PACKAGES:=$(IPKG_BASE) $(IPKG_LIBC) $(IPKG_GCC) +PACKAGES:=$(IPKG_BASE) $(IPKG_LIBC) +PACKAGES_INSTALL:=$(IPKG_BASE) $(IPKG_LIBC) + +ifeq ($(BR2_PACKAGE_LIBGCC),y) +PACKAGES+=$(IPKG_GCC) +PACKAGES_INSTALL+=$(IPKG_GCC) +endif +ifeq ($(BR2_PACKAGE_LIBGCC),m) +PACKAGES+=$(IPKG_GCC) +endif $(PKG_BUILD_DIR)/.prepared: mkdir -p $(PKG_BUILD_DIR) $(PACKAGE_DIR) @@ -62,7 +71,7 @@ $(IPKG_LIBC): $(IPKG_GCC): $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_GCC) ipkg/libgcc.control $(GCC_VERSION)-$(PKG_RELEASE) $(ARCH) mkdir -p $(IDIR_GCC)/lib - cp -fpR $(STAGING_DIR)/lib/libgcc*.so.* $(IDIR_GCC)/lib/ + cp -fpR $(STAGING_DIR)/lib/libgcc_s.so.* $(IDIR_GCC)/lib/ -$(STRIP) $(IDIR_GCC)/lib/* $(IPKG_BUILD) $(IDIR_GCC) $(PACKAGE_DIR) @@ -73,4 +82,4 @@ prepare: compile: $(PACKAGES) install: compile mkdir -p $(TARGET_DIR) - $(IPKG) install $(PACKAGES) + $(IPKG) install $(PACKAGES_INSTALL) diff --git a/openwrt/package/kismet/Makefile b/openwrt/package/kismet/Makefile index dab9e02781..49de9e234e 100644 --- a/openwrt/package/kismet/Makefile +++ b/openwrt/package/kismet/Makefile @@ -58,7 +58,7 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.built: $(MAKE) -C $(PKG_BUILD_DIR) \ CC=$(TARGET_CC) \ - LIBS="-L$(STAGING_DIR)/lib -fno-builtin -nostdinc++ -nodefaultlibs -luClibc++ -lc -lm" \ + LIBS="-L$(STAGING_DIR)/lib -fno-builtin -nostdinc++ -nodefaultlibs -luClibc++ -lc -lm -lgcc" \ CPPFLAGS="-I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(LINUX_DIR)/include" touch $@ diff --git a/openwrt/package/kismet/ipkg/kismet-server.control b/openwrt/package/kismet/ipkg/kismet-server.control index 3c416be83c..238f0f19e9 100644 --- a/openwrt/package/kismet/ipkg/kismet-server.control +++ b/openwrt/package/kismet/ipkg/kismet-server.control @@ -1,7 +1,7 @@ Package: kismet-server Priority: optional Section: net -Depends: uclibc++, libpcap +Depends: libgcc, uclibc++, libpcap Description: The kismet server Kismet is an 802.11 layer2 wireless network detector, sniffer, and intrusion detection system. Kismet will work with any diff --git a/openwrt/package/nmap/Makefile b/openwrt/package/nmap/Makefile index 2cded7e626..882180b971 100644 --- a/openwrt/package/nmap/Makefile +++ b/openwrt/package/nmap/Makefile @@ -26,7 +26,7 @@ $(PKG_BUILD_DIR)/.configured: CXXFLAGS="$(TARGET_CFLAGS) -fno-builtin -nostdinc++" \ CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ - LIBS="-nodefaultlibs -luClibc++ -lc -lm" \ + LIBS="-nodefaultlibs -luClibc++ -lc -lm -lgcc" \ ac_cv_prog_CXX="$(TARGET_CXX)" \ ./configure \ --target=$(GNU_TARGET_NAME) \ diff --git a/openwrt/package/nmap/ipkg/nmap.control b/openwrt/package/nmap/ipkg/nmap.control index ad2a984d12..56253fda0b 100644 --- a/openwrt/package/nmap/ipkg/nmap.control +++ b/openwrt/package/nmap/ipkg/nmap.control @@ -1,5 +1,5 @@ Package: nmap Priority: optional Section: net -Depends: libpcap, libpcre, uclibc++ +Depends: libgcc, libpcap, libpcre, uclibc++ Description: Nmap is a free open source utility for network exploration or security auditing. diff --git a/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 index 37f52710cb..ae05a020a2 100644 --- a/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 @@ -14,7 +14,6 @@ kmod-ppp kmod-pppoe kmod-switch kmod-wlcompat -libgcc mtd nvram ppp diff --git a/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 index 2d696cf359..3abd34ca05 100644 --- a/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 @@ -11,7 +11,6 @@ kmod-brcm-wl kmod-diag kmod-switch kmod-wlcompat -libgcc mtd nvram uclibc diff --git a/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 index f035268a0f..6786bde474 100644 --- a/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 @@ -14,7 +14,6 @@ kmod-ppp kmod-gre kmod-switch kmod-wlcompat -libgcc mtd nvram ppp diff --git a/openwrt/toolchain/gcc/3.4.4/static-libgcc.patch.conditional b/openwrt/toolchain/gcc/3.4.4/static-libgcc.patch.conditional new file mode 100644 index 0000000000..c8c1d849cd --- /dev/null +++ b/openwrt/toolchain/gcc/3.4.4/static-libgcc.patch.conditional @@ -0,0 +1,11 @@ +--- specs~ 2005-11-21 17:22:08.000000000 +0100 ++++ specs 2005-11-21 17:22:08.000000000 +0100 +@@ -51,7 +51,7 @@ + %{shared: -lc} %{!static:-rpath-link %R/lib:%R/usr/lib} %{!shared: %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}} + + *libgcc: +-%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared-libgcc:-lgcc --as-needed -lgcc_s%M --no-as-needed}%{shared-libgcc:-lgcc_s%M%{!shared: -lgcc}}}} ++%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}} + + *startfile: + %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} diff --git a/openwrt/toolchain/gcc/Makefile b/openwrt/toolchain/gcc/Makefile index dc7e02c7ae..f6f4acaab6 100644 --- a/openwrt/toolchain/gcc/Makefile +++ b/openwrt/toolchain/gcc/Makefile @@ -188,6 +188,16 @@ ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.) cp ./$(GCC_VERSION)/specs-$(ARCH)-soft-float $(STAGING_DIR)/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs endif endif +# We do another ugly hack here because the standard behaviour is +# to include a reference to libgcc.so.1 in all binaries. For flash space +# saving, we change the specs file to link in a static libgcc here. + if [ ! -f $(STAGING_DIR)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \ + echo staging dir specs file is missing ; \ + /bin/false ; \ + fi; + if grep -q as-needed $(STAGING_DIR)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs; then \ + patch -d $(STAGING_DIR)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/ -p0 < ./$(GCC_VERSION)/static-libgcc.patch.conditional ; \ + fi; source: $(DL_DIR)/$(GCC_SOURCE) prepare: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc -- 2.30.2